package com.qianseit.westore.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

import com.beautymiracle.androidclient.R;
import com.qianseit.westore.DoActivity;
import com.qianseit.westore.Run;

public class LauncherActivity extends DoActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		if (Run.loadFlag(this) < Run.getVersionCode(this)) {
			setMainFragment(new SplashFragment());
		} else {
			mHandler.sendEmptyMessageDelayed(0, 1500);
			getWindow().getDecorView()
					.setBackgroundResource(R.drawable.launch1);
		}
//		startActivity(new Intent(getBaseContext(),
//				MainHomeActivity.class));
//		finish();
	}

	private Handler mHandler = new Handler() {
		public void handleMessage(Message msg) {
			startActivity(new Intent(getBaseContext(),
					MainTabFragmentActivity.class));
//			startActivity(new Intent(getBaseContext(),
//					MainHomeActivity.class));
			finish();
		};
	};

	@Override
	public void finish() {
		super.finish();
		overridePendingTransition(android.R.anim.fade_in,
				android.R.anim.fade_out);
	}

}
